<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<script type="text/javascript" src="#{request.contextPath}/css/script/script.js"/>

	<h:panelGrid  columns="2" style="min-height:95%;width:100%"  columnClasses="top-align,top-align"   >  
		<h:column >
			<h:panelGrid columns="2" cellpadding="2" > 

	            <h:outputLabel value="#{msgs.Email} :" for="academyEmail" />
	            <p:inputText id="academyEmail" value="#{academyBean.academy.user.email}" maxlength ="50" size="50" required="true" requiredMessage="#{msgs.EmailObligatory}"/>
			
				<h:outputLabel value="#{msgs.Password} :"	for="academyPassword" />
				<p:password id="academyPassword" autocomplete="off"	redisplay="true"
					value="#{ academyBean.academy.user.password}" maxlength="15"	size="15" required="true" requiredMessage="#{msgs.PasswordObligatory}"/>
	
	            <h:outputLabel value="#{msgs.Name} :" for="academyName" /> 
	            <p:inputText id="academyName"	required="true"    value="#{academyBean.academy.name}" maxlength ="50" size="60" requiredMessage="#{msgs.AcademyNameObligatory}" />
	
	            <h:outputLabel value="#{msgs.Phone} :" for="academyPhone" styleClass="sp_celphones" />
	            <p:inputText id="academyPhone" 	value="#{academyBean.academy.user.phone}" maxlength ="22" size="22" styleClass="sp_celphones"  />

	            <h:outputLabel value="#{msgs.Owner} :" for="academyOwner" />
	            <p:inputText id="academyOwner" 	value="#{academyBean.academy.owner}"  maxlength ="50" size="50" required="true"  requiredMessage="#{msgs.OwnerNameObligatory}"  />


	            <h:outputLabel value="#{msgs.CNPJ} :" for="academyCnpj" />
	            <p:inputText id="academyCnpj" 	value="#{academyBean.academy.cnpj}" maxlength ="22" size="22" required="true"  styleClass="cnpj"  requiredMessage="#{msgs.CnpjObligatory}"   />


    	        <h:outputLabel value="#{msgs.State} :" for="academyState" />
	            <p:inputText id="academyState" value="#{academyBean.academy.state}" maxlength ="30" size="30" />

    	        <h:outputLabel value="#{msgs.City} :" for="academyCity" />
	            <p:inputText id="academyCity" value="#{academyBean.academy.city}" maxlength ="30" size="30" />
	
    	        <h:outputLabel value="#{msgs.Adrress} :" for="academyAddress" />
	            <p:inputText id="academyAddress" value="#{academyBean.academy.address}" maxlength ="50" size="50" />
		
    	        <h:outputLabel value="#{msgs.CEP} :" for="academyPostalCode" />
	            <p:inputText id="academyPostalCode" value="#{academyBean.academy.postalCode}" maxlength ="9" size="9"/>

    	        <h:outputLabel value="#{msgs.DefaultTheme} :" for="academyTheme" />

				<p:selectOneMenu id="academyTheme" value="#{academyBean.academy.theme}" converter="#{themeConverter}" validator="#{themeValidator.validate}" var="t" style="width:165px;text-align:left">  
                       <f:selectItems value="#{academyBean.advancedThemes}" var="theme" itemLabel="#{theme.name}" itemValue="#{theme}"  />
		            <p:column>
		                <p:graphicImage value="/css/images/themes/#{t.image}"/>
		            </p:column>
		            <p:column>
		                #{t.name}
		            </p:column>
		        </p:selectOneMenu>

	            <h:outputText value="#{msgs.Status} :" rendered="#{p:ifAnyGranted('ROLE_ADMIN')}" />
	            <p:selectOneRadio value="#{academyBean.academy.user.active}" rendered="#{p:ifAnyGranted('ROLE_ADMIN')}" >
	                <f:selectItem itemLabel="#{msgs.Active}"  	itemValue="true"   />
	                <f:selectItem itemLabel="#{msgs.Inactive}"	itemValue="false" />
	            </p:selectOneRadio>

				<h:outputLabel 	value="#{msgs.CreatedAt} :"		for="academyCreatedAt" rendered="#{academyBean.academy.id != null}"  />
				<p:inputText  	id="academyCreatedAt" 	value="#{academyBean.academy.user.createdAt}" disabled="true"  rendered="#{academyBean.academy.id != null}" >
					<f:convertDateTime locale="pt" dateStyle="long" pattern="dd/MM/yyyy HH:mm" />
				</p:inputText>

				<h:outputLabel 	value="#{msgs.ChangedAt} :"		for="academyChangedAt" rendered="#{academyBean.academy.id != null}" />
				<p:inputText  	id="academyChangedAt" 	value="#{academyBean.academy.user.lastChange}" disabled="true" rendered="#{academyBean.academy.id != null}" >
					<f:convertDateTime locale="pt" dateStyle="long" pattern="dd/MM/yyyy HH:mm" />
				</p:inputText>

				<h:outputLabel 	value="#{msgs.ExpireOn} :"		for="academyExpireOn" rendered="#{p:ifAnyGranted('ROLE_ADMIN')}" />
				<p:calendar		id="academyExpireOn"	value="#{academyBean.academy.user.expireOn}"	navigator="true" yearRange="c-10:c+10" readonlyInput="true"
					locale="pt"		timeZone="Brazil/East" selectOtherMonths="true" readOnlyInputText="true" required="true" requiredMessage="{msgs.ExpireOnObligatory}"
					rendered="#{p:ifAnyGranted('ROLE_ADMIN')}"  />

			</h:panelGrid>
		</h:column>
		<h:column>
			<p:panel header="#{msgs.AcademyLogotypes}" style="margin-top:5px;margin-left:50px;width:500px">
				<p:imageSwitch effect="fade" widgetVar="switcher" slideshowAuto="false"    >  
					<div align="center" style="width:100%">
						<h3>
							<h:outputText value="#{msgs.Logotype} 1 (120x100px)" />
						</h3>
						<p:commandLink oncomplete="wdlgupload.show();" process="@this"  >
							<p:graphicImage id="logoAcademy"   		title="#{msgs.Logotype} 120px x 100px"  cache="false" 	
								url="#{academyBean.academy.logo.folder}#{academyBean.academy.logo.location}" height="120px" width="100px" style="border:1px solid;"/>
							<f:setPropertyActionListener  value="#{1}" target="#{academyBean.uploadType}" />
						</p:commandLink>
						<br/>
					</div>
					<div align="center" style="width:100%">
						<h3>
							<h:outputText value="#{msgs.Logotype} 2 (80x250px)" />
						</h3>
						<p:commandLink oncomplete="wdlgupload.show();" process="@this" >
							<p:graphicImage id="wideLogoAcademy"  	title="#{msgs.Logotype} 80 x 250px" 	cache="false" 		
								url="#{academyBean.academy.logo.folder}#{academyBean.academy.wideLogo.location}"	height="80px" width="250px" style="border:1px solid;" /> 
							<f:setPropertyActionListener  value="#{2}" target="#{academyBean.uploadType}"/>
						</p:commandLink>
					</div>
				</p:imageSwitch>
				<div align="right" style="width:100%">
					<p:commandButton title="#{msgs.Previous}" type="button" onclick="switcher.previous();" styleClass="ui-button-icon-only" 
			               icon="ui-icon-circle-triangle-w" style="width:15px;height:15px;padding:0px;margin:0px"/>  
					<p:commandButton title="#{msgs.Next}" type="button" onclick="switcher.next();"  styleClass="ui-button-icon-only" 
			            icon="ui-icon-circle-triangle-e" style="width:15px;height:15px;padding:0px;margin:0px"/> 
				</div>
			</p:panel>
		</h:column>
	</h:panelGrid>	
</html>